$(function(){
    console.log(_gl._request);


    //日期初始化
    $('#valid-from-date-start').datetimepicker({
        format: 'yyyy-mm-dd',
        autoclose:true,
        minView: 'month',
        todayBtn:true,
        language:"zh-CN",
        startDate:_helper.getCurrentDate(),
        todayHighlight:false
    }).on("changeDate",function(){
        $('#valid-from-date-end').datetimepicker('setStartDate', $('#valid-from-date-start').val()||getCurrentDate());
        if($('#valid-from-date-end').val() && $('#valid-from-date-start').val()>$('#valid-from-date-end').val()){
            $('#valid-from-date-end').val("");
        }
    });

    $('#valid-from-date-end').datetimepicker({
        format: 'yyyy-mm-dd',
        autoclose:true,
        minView: 'month',
        todayBtn:true,
        language:"zh-CN",
        startDate:$('#valid-from-date-start').val()||_helper.getCurrentDate(),
        todayHighlight:false
    }).on("changeDate",function(){
    });

    //单选按钮初始化
    $(".radio_eula").iCheck({
        radioClass: "iradio_squaremini-blue"
    },function(){
        console.log("6");
    });

    //初始化按钮组
    if(_gl._request["flag"]=="add"){
        _helper.buttonFunInit([{"text":"新增","class":"add","callback":addItem}]);
    }else if(_gl._request["flag"]=="audit"){
        _helper.buttonFunInit([
            {"text":"审核","class":"audit","callback":auditItem},
            {"text":"修改","class":"update","callback":updateItem},
            {"text":"删除","class":"del","callback":delItem}
        ]);
    }

    //新增
    function addItem(){
        console.log("btn-add-coupon");
    }
    //审核
    function auditItem(){
        console.log("btn-audit-coupon");
    }
    //修改
    function updateItem(){
        console.log("btn-update-coupon");
    }
    //删除
    function delItem(){
        console.log("btn-del-coupon");
    }
});

